#ifndef __MYQUEUE_H_CLIENT_MAIN__
#define __MYQUEUE_H_CLIENT_MAIN__
#pragma once

#include<memory>
#include<list>
#include <crtdbg.h>

//##ModelId=44C4B5E5008C
template<class T>

class CMyQueue
{
public:
	//##ModelId=44C4B5E5008E
	CMyQueue(void)
	{
	}
	//##ModelId=44C4B5E5009C
	~CMyQueue(void)
	{
		QueueRemoveAll();
	}
private:
	//##ModelId=44C4B5E5009F
	CArray<*T,*T>  m_QueueNodeArray;
public:
	//##ModelId=44C4B5E500A3
	bool QueueInsert(T node)
	{
	   T *Node=new T;
	   if(Node==NULL)  return false;

	   memcpy((void *)Node,(void *)&node,sizeof(T));
	   m_QueueNodeArray.Add(Node);

	   return true;
	}
	//##ModelId=44C4B5E500A5
	void QueueDelete(unsigned int nIndex)
	{
		T *Node=NULL;
		Node=m_QueueNodeArray.GetAt(nIndex);
		if(Node!=NULL)
		{
			delete Node;
			m_QueueNodeArray.RemoveAt(nIndex);
		}
	}
	//##ModelId=44C4B5E500AC
    T *GetNodeOfQueue(unsinged int nIndex)
	{
		unsigned int nTotal;

		nTotal=m_QueueNodeArray.GetCount();
		if(nIndex>=nTotal)
		{
			return NULL;
		}else
		{
			return m_QueueNodeArray.GetAt(nIndex);
		}
	}
	//##ModelId=44C4B5E500AE
	void QueueRemoveAll()
	{
       while(m_QueueNodeArray.GetCount()!=0)
	   {
            QueueDelete(0);  
	   }
	}

	//##ModelId=44C4B5E500AF
	int GetCount()
	{
		return m_QueueNodeArray.GetCount();
	}


	
};
#endif//__MYQUEUE_H_CLIENT_MAIN__
